.sidebar {
  @include absolute(0);

  background-color: $palette-neutral-25;
  border-right: solid 1px $palette-neutral-200;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.sidebar__section {
  padding: 8px;
  flex: 0 0;

  &:not(:last-child) {
    border-bottom: solid 1px $palette-neutral-200;
  }

  &.sidebar__section--scrollable {
    flex: 1 1;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  &.sidebar__section--bottom {
    margin-top: auto;
  }
}

.sidebar__section-scrollable {
  overflow-y: auto;
  min-height: 0;
}

.sidebar__section-scrollable-inner {
  padding: 8px;
}

.sidebar__workspaces-selector {
  @include flex-align-items(10px);

  border-bottom: 1px solid $palette-neutral-200;
  padding: 0 16px;
  height: 51px;
  color: $palette-neutral-1200;
  font-weight: 500;

  &:hover {
    text-decoration: none;
  }

  .sidebar--collapsed & {
    justify-content: center;
  }
}

.sidebar__workspaces-selector-selected-workspace {
  @extend %ellipsis;

  flex: 1;
}

.sidebar__workspaces-selector-icon {
  font-size: 18px;
  color: $palette-neutral-600;
}

.sidebar__user {
  border-top: solid 1px $palette-neutral-200;
  background: $palette-neutral-25;
  padding-bottom: 8px;
  border-bottom-left-radius: $rounded-md;
  border-bottom-right-radius: $rounded-md;
}

.sidebar__user-email {
  font-weight: 500;
  font-size: 11px;
  color: $palette-neutral-900;
  padding-left: 8px;
}

.sidebar__user-info {
  @include flex-align-items;

  padding: 8px 8px 0;
  gap: 18px;
}

.sidebar__user-license {
  margin-left: auto;
  margin-right: 8px;

  &.badge.badge--neutral {
    background-color: $palette-neutral-200;
  }
}

.sidebar__new-wrapper {
  padding: 14px;
}

.sidebar__new-wrapper--separator {
  border-top: solid 1px $palette-neutral-200;
}

.sidebar__new {
  font-size: 13px;
  font-weight: 500;
  line-height: 17px;
  color: $palette-neutral-900;

  @include flex-align-items(4px);

  &:hover {
    color: $palette-neutral-1200;
    text-decoration: none;
  }
}

.sidebar__new-icon {
  font-size: 16px;
  color: $palette-neutral-600;

  .sidebar__new:hover & {
    color: $palette-neutral-1200;
  }
}

.sidebar__unread-notifications-icon {
  width: 8px;
  height: 8px;
  border-radius: 100%;
  background-color: $color-primary-500;
  margin-left: 4px;
}

.sidebar__impersonate {
  position: relative;
}

.sidebar__foot {
  height: 31px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;

  .sidebar--collapsed & {
    height: auto;
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
    flex-direction: column-reverse;
  }
}

.sidebar__foot-links {
  display: flex;
  gap: 16px;
  margin-top: -4px;

  .sidebar--collapsed & {
    flex-direction: column;
    margin-top: 0;
    margin-bottom: 16px;
  }
}

.sidebar__foot-separator {
  width: 1px;
  height: 16px;
  background-color: $palette-neutral-200;

  .sidebar--collapsed & {
    width: 16px;
    height: 1px;
  }
}

.sidebar__foot-link {
  position: relative;
  color: $palette-neutral-700;

  @include center-text(16px, 16px);

  &:hover {
    text-decoration: none;
    color: $palette-neutral-1200;
  }

  &.sidebar__foot-link--loading {
    color: transparent;

    &:hover {
      cursor: inherit;
      background-color: transparent;
    }

    &::before {
      content: '';
      z-index: 1;
      margin-top: -6px;
      margin-left: -6px;

      @include loading(12px);
      @include absolute(50%, auto, auto, 50%);
    }
  }
}

.sidebar__foot-link-icon {
  font-size: 18px;
}

.sidebar__workspace-active-icon {
  text-align: center;
  color: $palette-neutral-1200;
  position: absolute;
  top: 50%;
  right: 5px;
  font-size: 14px;
  transform: translateY(-50%);
}

.dashboard__user-workspaces.select__items {
  padding: 6px;

  .select__item {
    &.active:not(.select__item--loading) {
      background-color: transparent;
    }
  }
}

.dashboard__user-workspace-avatar {
  margin-right: 4px;
}

.sidebar__back-icon {
  font-size: 14px;
  color: $palette-neutral-700;
}

.sidebar__head {
  @include flex-align-items(15px);

  border-bottom: 1px solid $palette-neutral-200;
  padding: 0 21px;
  height: 51px;
  color: $palette-neutral-1200;
  font-weight: 500;

  .sidebar--collapsed & {
    justify-content: center;
    padding: 0;
  }
}

.sidebar__back {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: $palette-neutral-1200;

  @include rounded($rounded-md);

  &:hover {
    background-color: rgba($palette-neutral-1300, 0.04);
  }
}

.sidebar__title {
  font-size: 13px;
  font-weight: 500;
  color: $palette-neutral-1200;
}

.sidebar__logo {
  .sidebar--collapsed & {
    width: 16px;
    height: 16px;
    overflow: hidden;
    padding-left: 2px;
  }
}

.sidebar__collapse-link {
  font-size: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: $palette-neutral-1200;

  @include rounded($rounded-md);

  &:hover {
    background-color: rgba($palette-neutral-1300, 0.04);
  }
}

.sidebar__item-count {
  margin-left: auto;
  color: $palette-neutral-700;
}

.sidebar__search {
  margin-bottom: 8px;
  display: block;
  width: 100%;
  padding: 0;
  background-color: transparent;

  &:hover,
  &:not(.tree__action--disabled):hover {
    background-color: transparent;
  }
}

.sidebar__search-input {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  line-height: 36px;
  width: 100%;
  padding: 0 48px 0 8px;
  background-color: $white;
  border: 1px solid $palette-neutral-400;
  cursor: pointer;
  transition: all 0.2s ease;

  @include rounded($rounded-md);
  @include elevation($elevation-low);
}

.sidebar__search-icon {
  color: $palette-neutral-700;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar__search-placeholder {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  line-height: 12px;
  color: $palette-neutral-700;
  font-weight: 400;
}

.sidebar__search-shortcut {
  position: absolute;
  top: calc(50% - 8px);
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 2px;

  kbd {
    border: 0;
    background-color: $palette-neutral-100;
    border-radius: 3px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    color: $palette-neutral-700;
    height: 16px;
    line-height: 16px;
    padding: 0;
    min-width: 16px;
    text-align: center;
  }
}
